//
//  NewListTableViewCell.m
//  CarStop
//
//  Created by lanou3g on 15/7/16.
//  Copyright (c) 2015年 lanou3g. All rights reserved.
//

#import "NewListTableViewCell.h"
#import "NewList.h"

@implementation NewListTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{

    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.newsMessageLabel = [[UILabel alloc] initWithFrame:CGRectMake(110, 6, 260, 53)];
        self.newsMessageLabel.backgroundColor = [UIColor whiteColor];
        self.newsMessageLabel.numberOfLines = 2;
        [self addSubview:self.newsMessageLabel];
        
        
        self.newsPhotoView = [[UIImageView alloc] initWithFrame:CGRectMake(6, 6, 94, 76)];
        self.newsPhotoView.backgroundColor = [UIColor brownColor];
        [self addSubview:self.newsPhotoView];
        
        
        self.newsDateLabel = [[UILabel alloc] initWithFrame:CGRectMake(110, 60, 90, 22)];
        self.newsDateLabel.backgroundColor = [UIColor whiteColor];
        self.newsDateLabel.textColor = [UIColor grayColor];
        self.newsDateLabel.font = [UIFont systemFontOfSize:14];
        [self addSubview:self.newsDateLabel];
        
        
        self.newsReplycountLabel = [[UILabel alloc] initWithFrame:CGRectMake(295, 60, 35, 22)];
        self.newsReplycountLabel.backgroundColor = [UIColor whiteColor];
        self.newsReplycountLabel.textColor = [UIColor grayColor];
        self.newsReplycountLabel.textAlignment = NSTextAlignmentRight;
        self.newsReplycountLabel.font = [UIFont systemFontOfSize:14];
        [self addSubview:self.newsReplycountLabel];
     
        
        UILabel *textLabel = [[UILabel alloc] initWithFrame:CGRectMake(331, 60, 38, 22)];
        textLabel.backgroundColor = [UIColor whiteColor];
        textLabel.text = @"评论";
        textLabel.textColor = [UIColor grayColor];
        textLabel.font = [UIFont systemFontOfSize:14];
        [self addSubview:textLabel];
        
        
    }
    return self;
}


- (void)setNList:(NewList *)nList{

    if (_nList != nList) {
       
        
    }
    self.newsMessageLabel.text = self.nList.newsMessage;
    self.newsDateLabel.text = self.nList.newsDate;
    self.newsReplycountLabel.text = self.nList.newsReplycount;
  
    if (self.nList.newsPhoto) {
        self.newsPhotoView.image = self.nList.newsPhoto;
    }else{
        self.newsPhotoView.image = [UIImage imageNamed:@"Carrr"];
        [self.nList downloadPicture];

    NSLog(@"读取nList的set方法");
    }
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
